<extend name="Public:base" />
<!-- 网站标题 -->
<block name="title">页面管理</block>
<block name="appendheader">
    
	<!-- 删除确认插件 --> 
	<script type="text/javascript" src="__PUBLIC__/artDialog/jquery.artDialog.js?skin=default"></script> 
	<script type="text/javascript" src="__PUBLIC__/artDialog/iframeTools.js"></script> 
	<script type="text/javascript" src="__PUBLIC__/common/js/list.js"></script>
	
	<!-- Validform_v5.3.2验证框架 -->
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Validform/css/Validform_v5.3.2.css"/>
	<script type="text/javascript" src="__PUBLIC__/Validform/js/Validform_v5.3.2_min.js"></script>
	
	<!-- 拖动排序放于tooltip之前，否则会影响 -->
	<script type="text/javascript" src="__PUBLIC__/common/js/jquery-ui.js"></script>
	
	<!-- 弹出提示插件 -->
	<script src="__PUBLIC__/bootstrap/js/tooltip.js"></script>
	
	
	<!--编辑器js引入-->
	<script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.all.js"></script>
     
	<!-- 选中当前菜单引入 -->
	<script type="text/javascript">
		$(function() {
			$("#WebMenu-2000").addClass('active');	//选中父菜单
			$("#WebMenu-2009").addClass('active');	//选中当前菜单
		});
	</script>
	
	<script type="text/javascript">
		//选中左侧菜单
		$(function () {
			

			$("span.option-move").bind('mouseover',function() {
				$(this).css("cursor", "move");
			});
			//普通选项退拽排序
			$(".general-option").sortable({
				axis:'y',
				opacity: 0.6,
				revert: true,
				cursor: 'move',
				handle: '.option-move'
			});
			
			//tooltip提示工具
			
			$('[data-toggle="tooltip"]').tooltip();
		});
		
		 

	
		$(function() {
			var editor;
			var myform=$("#myform").Validform({
				tiptype:3,
				label:".label",
				showAllError:true,
				postonce:true,//开启二次提交防御
				ajaxPost:false,
				beforeSubmit:function(curform) {
					//在验证成功后，表单提交前执行的函数，curform参数是当前表单对象。
					lockScreen();
				},
				callback:function(data){
					$.Hidemsg();
				}
			});
			myform.addRule([
				ele:"#score",
				datatype:"/^[0-9]+.?[0-9]*$/",
		        nullmsg:"必须为数字，可以有小数",
			
			},
			{
				ele:"#scoreid",
				datatype:"/^[0-9]+.?[0-9]*$/",
		        nullmsg:"必须为数字，可以有小数"
			},
			{
				ele:"#title",
				datatype:"*1-100",
				nullmsg:"请输入标题"
			}]);
		});
		
		
		
		//添加一般选项插件
		function plusGeneralOption(Obj) {
			var str = '<div class="form-group">';
				str += '<label class="col-md-2 control-label">选项<span class="require">*</span></label>';
				str += '<div class="col-md-8">';
				str += '<div class="input-group">';
				str += '<span class="input-group-addon option-move"><i class="glyphicon glyphicon-resize-vertical"></i></span>';
				str += '<input type="text" name="select_item[]" class="form-control" />';
				str += '<span class="input-group-addon">';
				str += '<label style="margin:0">';
				str += '<input type="text" name="score_option[]" style="margin:0;padding:0;width:50px;height:20px;border:1px solid #e5e5e5;"/>&nbsp;分值';
				str += '</label>';
				str += '</span>';
				str += '<span class="input-group-addon">';
				str += '<label style="margin:0">';
				str += '<input type="checkbox" name="correct_option[]"  />&nbsp;正确答案';
				str += '<input type="hidden" name="is_correct[]" value="a" />';
				str += '</label>';
				str += '</span>';
				str += '</div>';
				str += '</div>';
				str += '<div class="col-md-2">';
				str += '<p class="form-control-static">';
				str += '<a href="javascript:void(0)" onclick="plusGeneralOption(this)" class="highlight" data-toggle="tooltip" data-placement="top" title="继续添加"><i class="fa fa-plus"></i></a>&nbsp;&nbsp;';
				str += '<a href="javascript:void(0)" onclick="minuGeneralOption(this)" class="highlight" data-toggle="tooltip" data-placement="top" title="删除选项"><i class="fa fa-trash-o"></i></a>';
				str += '</p>';
				str += '</div>';
				str += '</div>';
			$(Obj).parents(".form-group").after(str);
		}
		
		//移除一般选项插件
		function minuGeneralOption(Obj) {
			$(Obj).parents(".form-group").remove();
		}
		//提交时检测表单数据合法性
		function check_form() {
			//检测分值的合法性
			/*var score_obj = $("#score");
			if(Number(score_obj.val()) > Number('{$can_use_score}')) {
				art.dialog.alert("您填写的分值不能超过可分配的分值", function() { 
					score_obj.focus();	//聚焦当前文本框 
				});
				return false;
			}
			*/
			
		
		}
	</script>
</block>
<!-- 当前位置 -->
<block name="breadcrumb">
	<div class="page-header pull-left">
		<div class="page-title">问卷管理</div>
	</div>
	<ol class="breadcrumb page-breadcrumb pull-left">
		<li><i class="fa fa-home"></i>&nbsp;<a href="__APP__?g=Admin">首页</a>&nbsp;&nbsp;<i class="fa fa-angle-right"></i>&nbsp;&nbsp;</li>
		<li><a href="#">基础数据</a>&nbsp;&nbsp;<i class="fa fa-angle-right"></i>&nbsp;&nbsp;</li>
		<li class="active">问卷管理</li>
	</ol>
</block>
<block name="main_content">
	<div class="panel panel-default">
		<div class="panel-heading clearfix" >
			<h3 class="mts pull-left">添加附件题</h3>
			<div class="btn-add-content" style="text-align: right;">
				<a href="__APP__?g={:GROUP_NAME}&m=QuestionTestEdit&a=index&formid={$Think.request.formid}&mode=edit" class="btn btn-success "><i class="fa fa-reply"></i>返回问卷预览</a>&nbsp;&nbsp;
			</div>
		</div>
		<div class="panel-body mt-15">
			<form id="myform" action="__APP__?g=Admin&m=Affix&mode=edit&a=update" onsubmit="return check_form();" method="post" class="form-horizontal">
			
				<div class="form-group">
					<label class="col-md-2 control-label" for="score">标题<span class='require'>*</span></label>
					<div class="col-md-8">
						<input type="text" id="title" name="title" class="form-control" value="{$data.title}" />
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-md-2 control-label" for="score">代码<span class='require'>*</span></label>
					<div class="col-md-8">
						<input type="text" id="title" name="code" value="{$data.code}" class="form-control" />
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-md-2 control-label">说明</label>
						<div class="col-md-8" >
							<textarea id="content" name="intro" style="height:100px;">{$data.intro}</textarea>
							<script type="text/javascript">
			 					UE.getEditor('content');
							</script> 
						</div>
				</div>
				
				<div class="form-group">
					<label class="col-md-2 control-label" for="score">分值<span class='require'>*</span></label>
					<div class="col-md-8">
						<input type="text" id="score" name="score" value="{$data.score}" class="form-control" />
						<!-- <p class="help-block mt-15">本测验满分为<strong>100分</strong>，目前可分配的分值还剩<strong class="highlight">{$can_use_score}分</strong></p> -->
					</div>
				</div>
				
				<div class="form-group">
					<label class="col-md-2 control-label">文件格式</label>
					<div class="col-md-9">
					<label class="radio-inline">
						<input type="checkbox" id="ckAll" />&nbsp;全选&nbsp;&nbsp;
					</label>			
					<br>
					<label class="radio-inline">文档类格式：</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="DOC" <in name="ext" value="$data.ext">checked</in> />&nbsp;DOC&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="DOCX" <in name="ext" value="$data.ext">checked</in> />&nbsp;DOCX&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="PPT" <in name="ext" value="$data.ext">checked</in> />&nbsp;PPT&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="PPTX" <in name="ext" value="$data.ext">checked</in> />&nbsp;PPTX&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="XLS" <in name="ext" value="$data.ext">checked</in> />&nbsp;XLS&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="XLSX" <in name="ext" value="$data.ext">checked</in> />&nbsp;XLSX&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="TXT" <in name="ext" value="$data.ext">checked</in> />&nbsp;TXT&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="PDF" <in name="ext" value="$data.ext">checked</in> />&nbsp;PDF&nbsp;&nbsp;
						</label>
					<br>
					<label class="radio-inline">图片类格式：</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="JPG" <in name="ext" value="$data.ext">checked</in> />&nbsp;JPG&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="JPEG" <in name="ext" value="$data.ext">checked</in> />&nbsp;JPEG&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="PNG" <in name="ext" value="$data.ext">checked</in> />&nbsp;PNG&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="BMP" <in name="ext" value="$data.ext">checked</in> />&nbsp;BMP&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="GIF" <in name="ext" value="$data.ext">checked</in> />&nbsp;GIF&nbsp;&nbsp;
						</label>
					<br>
					<label class="radio-inline">音频类格式：</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="MP3" <in name="ext" value="$data.ext">checked</in> />&nbsp;MP3&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="WAVE" <in name="ext" value="$data.ext">checked</in> />&nbsp;WAVE&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="MPEG" <in name="ext" value="$data.ext">checked</in> />&nbsp;MPEG-4&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="MPEG" <in name="ext" value="$data.ext">checked</in> />&nbsp;MPEG&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="AIFF" <in name="ext" value="$data.ext">checked</in> />&nbsp;AIFF&nbsp;&nbsp;
						</label>
					<br>
					<label class="radio-inline">视频类格式：</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="MP4" <in name="ext" value="$data.ext">checked</in> />&nbsp;MP4&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="AVI" <in name="ext" value="$data.ext">checked</in> />&nbsp;AVI&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="MOV" <in name="ext" value="$data.ext">checked</in> />&nbsp;MOV&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="3GP" <in name="ext" value="$data.ext">checked</in> />&nbsp;3GP&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="FLV" <in name="ext" value="$data.ext">checked</in> />&nbsp;FLV&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="FLV" <in name="ext" value="$data.ext">checked</in> />&nbsp;FLV&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="RMVB" <in name="ext" value="$data.ext">checked</in> />&nbsp;RMVB&nbsp;&nbsp;
						</label>
						<label class="radio-inline">
							<input type="checkbox" id="type" name="ext[]" value="WMV" <in name="ext" value="$data.ext">checked</in> />&nbsp;WMV&nbsp;&nbsp;
						</label>
					</div>
				</div>
				<div class="form-group">
					<label class="col-md-2 control-label" for="size">大小<span class='require'>*</span></label>
					<div class="col-md-8" style="width:10%;">
						<input type="text" id="score" name="size" value="{$data.size}" class="form-control" />
					</div>
					<div  style="display:inline; font-size:large;">KB</div>
				</div>
			
				
				<div class="form-group">
					<div class="col-md-9 col-md-offset-2">
						<input type="hidden" name="questionid" value="{$Think.request.questionid}" />
						<input type="hidden" name="formid" value="{$Think.request.formid}" />
						<input type="submit" value="保存" class="btn btn-primary" />&nbsp;&nbsp;
						<input type="button" onclick="history.go(-1)" value="返回" class="btn btn-green" />
					</div>
				</div>
			</form>
		</div>
	</div>
</block>